1. Technical Field
This invention generally relates to computer systems, and more specifically relates to compilers that generate executable code for computer systems.
2. Background Art
Since the dawn of the computer age, computer systems have evolved into extremely sophisticated devices, and computer systems may be found in many different settings. Dramatic advances in both hardware and software (e.g., computer programs) have drastically improved the performance of computer systems. Modem software has become very complex when compared to early computer programs. Many modem computer programs have tens or hundreds of thousands of instructions. The execution time (and hence, performance) of a computer program is very closely related to the number of instructions that are executed as the computer program runs. Thus, as the size and complexity of computer programs increase, the execution time of the computer program increases as well.
Unlike early computer programs, modem computer programs are typically written in a high-level language that is easy to understand by a human programmer. Special software tools known as compilers take the human-readable form of a computer program, known as “source code”, and convert it into “machine code” or “object code” instructions that may be executed by a computer system. Because a compiler generates the stream of machine code instructions that are eventually executed on a computer system, the manner in which the compiler converts the source code to object code affects the execution time of the computer program.
The execution time of a computer program, especially complex computer programs, is a function of the arrangement and type of instructions within the computer program. Loops affect the execution time of a computer program. If a computer program contains many loops, or contains any loops that are executed a relatively large number of times, the time spent executing loops will significantly impact the execution time of a computer program.
In order to optimize the performance of modem computer programs, profilers have been developed to predict and/or measure the run-time performance of a computer program. Profilers typically generate profile data that estimates how often different portions of the computer program are executed. Using profile data, an optimizer (such as an optimizing compiler) may make decisions to optimize loops in a computer program in order to improve the execution speed of the computer program.
Known methods for using profile data to optimize loops in a computer program do not provide an optimal solution. As a result, the prior art may yield inefficiencies in loops that result in a slower execution time for the computer program. Without improved apparatus and methods for optimizing loops in a computer program, a compiler will generate a computer program that is not as fully optimized as it might be.